package gtgold;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * Title screen that displays a splash image and game startup buttons
 * 
 * @author joOh, jo, jen
 */
public class TitleScreen extends JPanel
{
	private static final long serialVersionUID = 1L;
	private JButton startButton;

	public TitleScreen()
	{
		setPreferredSize(OregonTrail.VGA);
		setLayout(new GridLayout(1, 1));

		// BG JPanel
		bgImagePanel mainPanel = new bgImagePanel(
				"src/gtgold/img/SPLASHSCREEN.jpg");
		add(mainPanel, BorderLayout.CENTER);
		mainPanel.setLayout(new GridLayout(1, 1));

		// Attributes JPanel
		JPanel panel = new JPanel();
		panel.setOpaque(false);
		panel.setLayout(new GridLayout(9, 6));

		for (int i = 0; i < 50; i++)
		{
			panel.add(new JLabel());
		}
		startButton = new JButton("New Game");
		startButton.addActionListener(new ButtonListener());
		panel.add(startButton);
		for (int i = 0; i < 4; i++)
		{
			panel.add(new JLabel());
		}

		mainPanel.add(panel);
		add(mainPanel);
	}

	private class ButtonListener implements ActionListener
	{
		public void actionPerformed(ActionEvent ae)
		{
			if (ae.getSource() == startButton)
			{
				OregonTrail.configScreen();
			}
		}
	}
}
